export const tableInspect = () => {

    const checkChange = (row) => {
        console.log('row', row)
        if (row.check) {
            row.popoverIsshow = true
        } else {
            row.popoverIsshow = false
        }
    }
    const objectSpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
        if (columnIndex === 0) {
            if (rowIndex % 2 === 0) {
                return {
                    rowspan: 2,
                    colspan: 1,
                };
            } else {
                return {
                    rowspan: 0,
                    colspan: 0,
                };
            }
        }
    };

    const cleanr = (row) => {
        row.radio = ''
    }

    const close = (row) => {
        row.radio = ''
        row.checkList = []
        row.popoverIsshow = false

    }
    const submit = (row) => {
        row.methodList = [row.radio, ...row.checkList].map((val) => {
            const map = {
                0: '平扫',
                1: '增强扫描',
                3: '三维重建'
            }
            return map[val]
        }).join(',')
        row.popoverIsshow = false
    }
    const inspectData = reactive([
        {
            name: "01-椎间盘",
            id: 1,
            check: false,
            popoverIsshow: false,
            radio: "",
            checkList: [],
            methodList: "",
        },
        {
            name: "01-椎间盘",
            id: 2,
            check: false,
            popoverIsshow: false,
            radio: "",
            checkList: [],
            methodList: "",
        },
        {
            name: "01-头部",
            check: false,
            popoverIsshow: false,
            radio: "",
            checkList: [],
            methodList: "",
        },
    ]);

    return {
        checkChange,
        objectSpanMethod,
        cleanr,
        close,
        submit,
        inspectData
    }
}